<?php
  header("Content-type:application/x-www-form-urlencoded;charset=utf8");
  header("luojie:123");
  $method = $_SERVER['REQUEST_METHOD'];
  $content_type = $_SERVER['CONTENT_TYPE'];
  if ($method == "POST") {

    switch ($content_type) {
    	case 'application/json':
    		echo json_encode($_POST);
    		break;
    	case 'application/x-www-form-urlencoded':

    		   $result = "";
			   foreach ($_POST as $key => $value) {
			   	 $result .=$key."=".$value."\r\n";
			   }
               echo $result;
    		break;
        
        case 'text/xml':
        	echo "text/xml\r\n".json_encode($_POST);
        	break;
        case 'multipart/form-data':
        	
        	break;
    	default:
    		
    		break;
    }

  } else if ($method == 'GET') {
          $result = "";
			   foreach ($_POST as $key => $value) {
			   	 $result .=$key."=".$value."\r\n";
			   }
               echo $result;

  }




 ?>